package com.atguigu.dga.assess.assess.spec;

import com.atguigu.dga.assess.assess.AssessorTemplate;
import com.atguigu.dga.assess.bean.AssessParam;
import com.atguigu.dga.assess.bean.GovernanceAssessDetail;
import com.atguigu.dga.meta.bean.TableMetaInfoExtra;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Component;

import java.math.BigDecimal;

@Component("HAVE_BUS_OWNER")
public class CheckBusiOwnner extends AssessorTemplate {

    @Override
    protected void assess(AssessParam param,GovernanceAssessDetail detail) {
        TableMetaInfoExtra tableMetaInfoExtra = param.getTableMetaInfo().getTableMetaInfoExtra();
        if (StringUtils.isBlank(tableMetaInfoExtra.getBusiOwnerUserName())){
            //打分
            detail.setAssessScore(BigDecimal.ZERO);
            detail.setAssessProblem("未指定业务负责人");
            //跳转到对应的页面进行整改
            detail.setGovernanceUrl(param.getMetric().getGovernanceUrl().replace("{id}",param.getTableMetaInfo().getId().toString()));
        }
    }

}




















